const express = require('express');

const app = express();

const userModel = require('./db/models/userModel');

const loginRouter = require('./routers/loginRouter')
const userRouter = require('./routers/userRouter');
const verifyToken = require('./middlewares/verifyToken');

// const setCORS = require('./middlewares/setCORS');

// app.use(setCORS);

// 解析请求体数据中间件
app.use(express.urlencoded({ extended: false }))
app.use(express.json({ extended: false }))

// 配置静态资源目录
app.use(express.static(__dirname+'/public'))

// 路由器调用
app.use(loginRouter);
app.use('/admin/user',verifyToken,userRouter);

app.listen(8082,()=>{
    console.log("服务启动成功-8082");
})

